package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 二维码扫描记录表
 * @TableName qr_code_scan
 */
@TableName(value ="qr_code_scan")
@Data
public class QrCodeScan implements Serializable {
    /**
     * 扫描记录ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 扫描用户ID
     */
    private Long userId;

    /**
     * 二维码内容
     */
    private String qrContent;

    /**
     * 二维码类型(VEHICLE:车辆,TASK:任务,OTHER:其他)
     */
    private String qrType;

    /**
     * 扫描结果(SUCCESS:成功,FAILED:失败,INVALID:无效)
     */
    private String scanResult;

    /**
     * 目标对象ID(车辆ID或任务ID等)
     */
    private Long targetId;

    /**
     * 扫描位置
     */
    private String scanLocation;

    /**
     * 设备信息
     */
    private String deviceInfo;

    /**
     * IP地址
     */
    private String ipAddress;

    /**
     * 错误信息
     */
    private String errorMessage;

    /**
     * 扫描时间
     */
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        QrCodeScan other = (QrCodeScan) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getQrContent() == null ? other.getQrContent() == null : this.getQrContent().equals(other.getQrContent()))
            && (this.getQrType() == null ? other.getQrType() == null : this.getQrType().equals(other.getQrType()))
            && (this.getScanResult() == null ? other.getScanResult() == null : this.getScanResult().equals(other.getScanResult()))
            && (this.getTargetId() == null ? other.getTargetId() == null : this.getTargetId().equals(other.getTargetId()))
            && (this.getScanLocation() == null ? other.getScanLocation() == null : this.getScanLocation().equals(other.getScanLocation()))
            && (this.getDeviceInfo() == null ? other.getDeviceInfo() == null : this.getDeviceInfo().equals(other.getDeviceInfo()))
            && (this.getIpAddress() == null ? other.getIpAddress() == null : this.getIpAddress().equals(other.getIpAddress()))
            && (this.getErrorMessage() == null ? other.getErrorMessage() == null : this.getErrorMessage().equals(other.getErrorMessage()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getQrContent() == null) ? 0 : getQrContent().hashCode());
        result = prime * result + ((getQrType() == null) ? 0 : getQrType().hashCode());
        result = prime * result + ((getScanResult() == null) ? 0 : getScanResult().hashCode());
        result = prime * result + ((getTargetId() == null) ? 0 : getTargetId().hashCode());
        result = prime * result + ((getScanLocation() == null) ? 0 : getScanLocation().hashCode());
        result = prime * result + ((getDeviceInfo() == null) ? 0 : getDeviceInfo().hashCode());
        result = prime * result + ((getIpAddress() == null) ? 0 : getIpAddress().hashCode());
        result = prime * result + ((getErrorMessage() == null) ? 0 : getErrorMessage().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userId=").append(userId);
        sb.append(", qrContent=").append(qrContent);
        sb.append(", qrType=").append(qrType);
        sb.append(", scanResult=").append(scanResult);
        sb.append(", targetId=").append(targetId);
        sb.append(", scanLocation=").append(scanLocation);
        sb.append(", deviceInfo=").append(deviceInfo);
        sb.append(", ipAddress=").append(ipAddress);
        sb.append(", errorMessage=").append(errorMessage);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}